package models;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import play.db.jpa.Model;

@Entity
@Table(name = "Task_User_Users", uniqueConstraints = { @UniqueConstraint(columnNames = {
		"task_id", "assignee_id", "user_id" }) })
public class TaskUserUser extends Model {
	public boolean status;

	//public boolean isSuggestion; // if true that a developer is suggesting else it
								// is a suggestion

	@ManyToOne
	@JoinColumn(name = "user_id")
	public User user;

	@ManyToOne
	@JoinColumn(name = "assignee_id")
	public User assignee;

	@ManyToOne
	@JoinColumn(name = "task_id")
	public Task task;

	// will be used in case a developer assigns himself
	public TaskUserUser(User assignee, Task task)
	{
		this.assignee = assignee;
		this.task = task;
		//isSuggestion = false;
		status = true;
	
	}
	// will be used in case of a suggestion
	public TaskUserUser(User user, User assignee,  Task task)
	{
		this.user = user;
		this.assignee = assignee;
		this.status = false;
		this.task = task;
	}
}
